package com.wangge.proxy.cglibProxy;

public class Sayhello {
  public void hello() {
    System.out.println("say hello!!");
  }
  
  final public void sayBye() {
    System.out.println("Bye Bye!!");
  }
  
  static void eat() {
    System.out.println("eating food !!");
  }
  
  public static void main(String[] args) {
    CglibProxy proxy = new CglibProxy();
    Sayhello say = (Sayhello) proxy.getProxy(Sayhello.class);
    say.hello();
    //子类无法重写父类的final方法和static方法
    say.sayBye();//不会执行代理逻辑
    say.eat();//不会执行代理逻辑
    //无法继承final类,抛出异常:java.lang.IllegalArgumentException
//    SayBye bye = (SayBye) proxy.getProxy(SayBye.class);
//    bye.sayBye();
  }
}
